package demo1;
import java.util.Random;

public class Test {
    public static void main(String[] args) {

    }
    public static void main1(String[] args) {
        Random rand = new Random();
        HashBucket hashBucket = new HashBucket();
        int[] array = new int[1000_0000];
        for(int i = 0; i < array.length; i++) {
            array[i] = rand.nextInt(1000);
        }
        for(int i = 0; i < array.length; i++) {
            hashBucket.put(array[i],array[i]*10);
        }
        /**
         * 测试普通搜索与哈希搜索的速度*/
        long start1 = System.currentTimeMillis();
        for(int i = 0; i < array.length; i++) {
            if(array[i] == 1001) {
                break;
            }
        }
        long end1 = System.currentTimeMillis();
        System.out.println("普通测试"+(end1-start1));


        long start2 = System.currentTimeMillis();
        hashBucket.get(888888);
        long end2 = System.currentTimeMillis();
        System.out.println("哈希测试"+(end2-start2));
    }
}
